#include <stdio.h>
int main()
{
	int m = 0;
	scanf_s("%d", &m);
	int sum = 0;
	int empty = m;
	while ( empty> 1)
	{
		sum += empty / 2;
		empty = empty % 2 + empty / 2;
	}
	printf("%d\n", sum);
	return 0;
}